<div class="box">
  <div class="box-header">
      
    <div class="row">
        <div class="col-sm-8">
            <div class="box-tools search-form pull-right">
                <div class="input-group input-group-sm">
                    <input type="text" name="invitation" style="width: 300px;" class="form-control pull-right" value="{:input('invitation')}" placeholder="核销码">
                    <div class="input-group-btn">
                      <button type="button" id="search"  url="{:url('orderLists')}" class="btn btn-info btn-flat"><i class="fa fa-search"></i></button>
                    </div>
                </div>
           </div>
        </div>
    </div>

  </div>
  <div class="box-body table-responsive">
    <table  class="table table-bordered table-hover table-striped">
      <thead>
      <tr>
		  <th>订单号</th>
		  <th>用户</th>
          <th>商品名</th>
		  <th>支付方式</th>
		  <th>订单总价</th>
		  <th>商品单价</th>
          <th>购买数量</th>
          <th>支付时间</th>
		  <th>状态</th>
          <th>操作</th>
      </tr>
      </thead>
      
      {notempty name='list'}
        <tbody>
            {volist name='list' id='vo'}
                <tr>
				  <td>{$vo.order_sn}</td>
                  <td>{$vo.username}<br/><span style="color:red">{$vo.name}</span></td>
				  <td>{$vo.title}</td>
				  <td>{$vo.pay|getPay}</td>
                  <td>{$vo.money}</td>
				  <td>{$vo.danjia}</td>
				  <td>{$vo.num}</td>
				  <td>{$vo.zf_time}</td>
				  <td>{if $vo.stat == 0}<span style="color:red">待发货</span>{/if}{if $vo.stat == 1}已发货{/if}{if $vo.stat == 2}确认收货{/if}</td>
                    <td class="col-md-2 text-center">
                        {if $vo.stat == 1 && $vo.is_xx == 1 && !empty($invitation)}<ob_link><a onclick="opInvitation({$vo.id})" class="btn "><i class="fa fa-edit"></i> 核销使用</a></ob_link>{/if}
                    </td>
                </tr>
            {/volist}
        </tbody>
        {else/}
        <tbody><tr class="odd"><td colspan="10" class="text-center" valign="top">{:config('empty_list_describe')}</td></tr></tbody>
      {/notempty}
    </table>
      

  </div>
  <div class="box-footer clearfix text-center">
      {$list->render()}
  </div>
    <script>
        function opInvitation(id){
            layer.msg('确定核销使用吗？', {
                time: 0 //不自动关闭
                ,btn: ['确定', '取消']
                ,yes: function(index){
                    layer.close(index);
                    $.post("{:url('opOrder')}", { id: id}, function (data) {
                        if (data.code == 0) {
                            layer.msg(data.msg);
                            location.reload();
                        } else {
                            layer.msg(data.msg);
                        }
                    }, 'json');
                }
            });
        }
    </script>
</div>